//package com.plian.system.service.yth.impl;
//
//import com.baomidou.dynamic.datasource.annotation.DS;
//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
//import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
//import com.plian.Tools.CollectionUtil;
//import com.plian.system.entity.dj.DjPartymassServicesInfo;
//import com.plian.system.entity.yth.dj.PartyServiceMap;
//import com.plian.system.mapper.yth.dj.PartyServiceMapMapper;
//import com.plian.system.service.yth.IPartyServiceMapService;
//import lombok.AllArgsConstructor;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Propagation;
//import org.springframework.transaction.annotation.Transactional;
//
//import java.util.*;
//
///**
// * @Description:
// * @Author: jatpen
// * @Date: 2023/4/19 9:46 AM
// */
//@Slf4j
//@Service
//@DS("slave_1")
//public class PartyServiceMapServiceImpl extends ServiceImpl<PartyServiceMapMapper, PartyServiceMap> implements IPartyServiceMapService {
//
//    private final String YTH_DATASOURCE_TYPE = "3";
//
//    @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
//    @DS("slave_1")
//    @Override
//    public List<DjPartymassServicesInfo> getSyncData(Date startTime, Date endTime) {
//        List<DjPartymassServicesInfo> djPartymassServicesInfos = new ArrayList<>();
//        List<PartyServiceMap> partyServiceMaps = list(new LambdaQueryWrapper<PartyServiceMap>()
//                .gt(Optional.ofNullable(startTime).isPresent(), PartyServiceMap::getCreateTime, startTime)
//                .le(Optional.ofNullable(endTime).isPresent(), PartyServiceMap::getCreateTime, endTime)
//        );
//        if (CollectionUtil.isNotEmpty(partyServiceMaps)) {
//            djPartymassServicesInfos = conversion(partyServiceMaps);
//        }
//        return djPartymassServicesInfos;
//    }
//
//    /**
//     * 转换党群服务中心地图
//     *
//     * @return
//     * @param:
//     * @date: 2023/4/19 10:26 AM
//     * @author: jatpeo
//     */
//    private List<DjPartymassServicesInfo> conversion(List<PartyServiceMap> partyServiceMaps) {
//        List<DjPartymassServicesInfo> djPartymassServicesInfoList = new ArrayList<>();
//        for (PartyServiceMap partyServiceMap : partyServiceMaps) {
//            DjPartymassServicesInfo djPartymassServicesInfo = new DjPartymassServicesInfo();
//            djPartymassServicesInfo.setPartymassServicesName(partyServiceMap.getServiceCenterName());
//            djPartymassServicesInfo.setPartymassServicesAddress(partyServiceMap.getServiceCenterAddress());
//            djPartymassServicesInfo.setAttributionUnitId(Objects.toString(partyServiceMap.getBelongUnitId(), null));
//            djPartymassServicesInfo.setAttributionUnitName(partyServiceMap.getBelongUnitName());
//            djPartymassServicesInfo.setPartymassServicesNum(Objects.toString(partyServiceMap.getServiceCenterNumber(), null));
//            djPartymassServicesInfo.setContact(partyServiceMap.getPhoneNumber());
//            djPartymassServicesInfo.setPartymassServicesActivityTheme(partyServiceMap.getActivitiesTheme());
//            djPartymassServicesInfo.setOrganizationName(partyServiceMap.getOrgName());
//            djPartymassServicesInfo.setParticipantsNum(Objects.toString(partyServiceMap.getParticipateNumber(), null));
//            djPartymassServicesInfo.setPartymassServicesCenterDesp(partyServiceMap.getIntroduction());
//            djPartymassServicesInfo.setDataSource(YTH_DATASOURCE_TYPE);
//            djPartymassServicesInfo.setDataSourceId(partyServiceMap.getId().toString());
//            djPartymassServicesInfoList.add(djPartymassServicesInfo);
//        }
//        return djPartymassServicesInfoList;
//    }
//
//}
